﻿@using System.Collections
@using SimpleScrum.Areas.Scrum.Models
@using SimpleScrum.Core.Entities
@using SimpleScrum.Utils
@{
    var organizationModel = new OrganizationModel();
    var organizations = organizationModel.GetOrganizations();
    var projectModel = new ProjectModel();
    var projectDefault = projectModel.GetProjectById(@Client.Instance.DefaultProjectId);
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - Simple Scrum</title>
        <link href="~/scrum.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="description" content="" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        @*<link rel="stylesheet" href="~/Content/Customize/css/Customize.css" />*@
        <link rel="stylesheet" href="~/Content/Customize/css/bootstrap.min.css" />
        <link rel="stylesheet" href="~/Content/Customize/css/bootstrap-responsive.min.css" />
        <link rel="stylesheet" href="~/Content/Customize/css/font-awesome.min.css" />
        <link rel="stylesheet" href="~/Content/Customize/fonts.googleapis.com/css5c0a.css?family=Open+Sans:400,300" />
        <link rel="stylesheet" href="~/Content/Customize/css/scrum.min.css" />
        <link rel="stylesheet" href="~/Content/Customize/css/scrum-responsive.min.css" />
        <link rel="stylesheet" href="~/Content/Customize/css/scrum-skins.min.css" />
    </head>
    <body>
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a href="#" class="brand">
                        <small><i class="icon-cogs "></i>&nbsp;Simple Scrum</small>
                    </a>
                    <!--/.brand-->
                    <ul class="nav scrum-nav pull-right">
                        <li class="purple">
                            <a data-toggle="dropdown" class="dropdown-toggle" href="@Url.Action("Details", "Project", new {id=projectDefault.Id})">
                                <i class="icon-wrench icon-animated-wrench"></i>
                                <span class="badge badge-important">@projectDefault.Name</span>
                            </a>
                            <ul class="pull-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-closer">
                                @if (organizations.Count == 0)
                                {
                                    <li>
                                        <a href="@Url.Action("New", "Organization")">
                                            <i class="clearfix"></i>
                                            Create Organization
                                        </a>
                                    </li>
                                }
                                else
                                {
                                    <li class="nav-header">
                                        <i class="icon-refresh"></i>
                                        Set as default in Projects
                                    </li>
                                    foreach (var item in organizations)
                                    {
                                        if (item.ProjectCollection.Count == 0)
                                        {
                                            <li>
                                                <a href="@Url.Action("New", "Project")">
                                                    <i class="clearfix"></i>
                                                    Create Project
                                                </a>
                                            </li>
                                        }
                                        else
                                        {
                                            foreach (var itemp in item.ProjectCollection)
                                            {
                                                <li>
                                                    <a href="@Url.Action("Details", "Project", new { id = itemp.Id })">
                                                        <div class="clearfix">
                                                            <span class="pull-left">@itemp.Name</span>
                                                            <span class="pull-right">40%</span>
                                                        </div>
                                                        <div class="progress progress-mini progress-success progress-striped active">
                                                            <div style="width:40%" class="bar"></div>
                                                        </div>
                                                    </a>
                                                </li>
                                            }
                                        }
                                    }
                                }
                                <li>
                                    <a href="@Url.Action("Index", "Project")">
                                        <span class="menu-text">See All Projects</span>
                                        <i class="icon-arrow-right"></i>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="light-blue">
                            <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                                <img class="nav-user-photo" src="~/Content/Customize/avatars/avatar2.png" alt="@Client.Instance.ClientName's Photo" />
                                <span class="user-info"><small>Welcome,</small>@Client.Instance.ClientName</span>
                                <i class="icon-caret-down"></i>
                            </a>
                            <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-closer">
                                <li>
                                    <a href="@Url.Action("Index", "Organization")">
                                        <i class="icon-random"></i>
                                        <span class="menu-text">Organizations</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="@Url.Action("Manage", "Accounts")"><i class="icon-cog"></i>Settings</a>
                                </li>
                                <li>
                                    <a href="@Url.Action("Profile", "Accounts")"><i class="icon-user"></i>Profile</a>

                                </li>
                                <li class="divider"></li>
                                <li class="text-center">
                                    @using (Html.BeginForm("LogOff", "DashBoard", FormMethod.Post, new { id = "logoutForm", @class = "menu-text" }))
                                    {
                                        @Html.AntiForgeryToken()
                                        <a href="javascript:document.getElementById('logoutForm').submit()" class="middle btn btn-mini btn-danger">
                                            <i class="icon-power-off"></i><span class="menu-text">Logout</span>
                                        </a>
                                    }
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <!--/.scrum-nav-->
                </div>
                <!--/.container-fluid-->
            </div>
            <!--/.navbar-inner-->
        </div>
        <div class="main-container container-fluid">
            @Html.Partial("_SidebarPartial")
            <div class="main-content">
                @RenderBody()
                <div class="scrum-settings-container" id="scrum-settings-container">
                    <div class="btn btn-app btn-mini btn-light scrum-settings-btn" id="scrum-settings-btn">
                        <i class="icon-cog bigger-150"></i>
                    </div>
                    <div class="scrum-settings-box" id="scrum-settings-box">
                        <div>
                            <div class="pull-left">
                                <select id="skin-colorpicker" class="hide">
                                    <option data-class="default" value="#438EB9">#438EB9</option>
                                    <option data-class="skin-1" value="#222A2D">#222A2D</option>
                                    <option data-class="skin-2" value="#C6487E">#C6487E</option>
                                    <option data-class="skin-3" value="#D0D0D0">#D0D0D0</option>
                                </select>
                            </div>
                            <span>&nbsp; Choose Skin</span>
                        </div>
                        <div>
                            <input type="checkbox" class="scrum-checkbox-2" id="scrum-settings-header" />
                            <label class="lbl" for="scrum-settings-header">Fixed Header</label>
                        </div>
                        <div>
                            <input type="checkbox" class="scrum-checkbox-2" id="scrum-settings-sidebar" />
                            <label class="lbl" for="scrum-settings-sidebar">Fixed Sidebar</label>
                        </div>
                        <div>
                            <input type="checkbox" class="scrum-checkbox-2" id="scrum-settings-breadcrumbs" />
                            <label class="lbl" for="scrum-settings-breadcrumbs">Fixed Breadcrumbs</label>
                        </div>
                        <div>
                            <input type="checkbox" class="scrum-checkbox-2" id="scrum-settings-rtl" />
                            <label class="lbl" for="scrum-settings-rtl">Right To Left (rtl)</label>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-small btn-inverse">
            <i class="icon-double-angle-up icon-only bigger-110"></i>
        </a>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
        <script type="text/javascript">
            window.jQuery || document.write("<script src='~/Content/Customize/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
        </script>
        <script type="text/javascript">
            if ("ontouchend" in document) document.write("<script src='~/Content/Customize/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
        </script>
        <script src="~/Content/Customize/js/bootstrap.min.js"></script>
        @RenderSection("scripts", required: false)
        <script src="~/Content/Customize/js/scrum-elements.min.js"></script>
        <script src="~/Content/Customize/js/scrum.min.js"></script>
        @RenderSection("scriptsText", required: false)
        <script type="text/javascript">
            var url = window.location;
            // Will only work if string in href matches with location
            $('ul.nav a[href="' + url + '"]').parent().addClass('active');

            // Will also work for relative and absolute hrefs
            $('ul.nav a').filter(function () {
                return this.href == url;
            }).parent().addClass('active');
        
            /*menu handler*/
            $(function () {
                function stripTrailingSlash(str) {
                    if (str.substr(-1) == '/') {
                        return str.substr(0, str.length - 1);
                    }
                    return str;
                }

                var url = window.location.pathname;
                var activePage = stripTrailingSlash(url);

                $('.nav li a').each(function () {
                    var currentPage = stripTrailingSlash($(this).attr('href'));

                    if (activePage == currentPage) {
                        $(this).parent().addClass('active');
                    }
                });
            });
        </script>

    </body>

</html>